function data = get_datawin(ptstruct,pt,nwin)
% Get data from the patients

data = [];
indhr = find(nwin(1) <= ptstruct(pt).data{1}.hr(:,1) & ...
    ptstruct(pt).data{1}.hr(:,1) < nwin(2));
indpp = find(nwin(1) <= ptstruct(pt).data{1}.pulsep(:,1) & ...
    ptstruct(pt).data{1}.pulsep(:,1) < nwin(2));
indla = find(nwin(1) <= ptstruct(pt).data{1}.lactate(:,1) & ...
    ptstruct(pt).data{1}.lactate(:,1) < nwin(2));
induo = find(nwin(1) <= ptstruct(pt).data{1}.uo(:,1) & ...
    ptstruct(pt).data{1}.uo(:,1) < nwin(2));
data = [median(ptstruct(pt).data{1}.hr(indhr,2)), ...
    median(ptstruct(pt).data{1}.pulsep(indpp,2)), ...
    median(ptstruct(pt).data{1}.lactate(indla,2)), ...
    median(ptstruct(pt).data{1}.uo(induo,2))];

end

% Perfect